package business
{
	import mx.rpc.AsyncToken;
	import mx.rpc.remoting.RemoteObject;
	
	import org.servebox.foundry.service.AbstractBusinessDelegate;
	import org.servebox.foundry.service.IBusinessDelegate;
	import org.servebox.foundry.service.IBusinessResponder;
	
	import value.ContactListTO;

	public class MainBusinessDelegate extends AbstractBusinessDelegate implements IBusinessDelegate
	{
		private static var _instance : MainBusinessDelegate;
		
		public function MainBusinessDelegate( service : Object = null )
		{
			super( service );
		}
		
		public function getAllContact( responder : IBusinessResponder ) : void
		{
			linkResponderToCall( AMFPHPFacade().getAllContact() as Object, responder );
		}
		protected function linkResponderToCall( token : Object, responder : IBusinessResponder ):void
		{
			AsyncToken( token ).addResponder( responder );
		}
		
		protected function AMFPHPFacade() : RemoteObject
		{
			return RemoteObject( getService() );
		}
		
		public static function getInstance() : MainBusinessDelegate
		{
			if ( _instance == null )
			{
				_instance = new MainBusinessDelegate();
			}
			return _instance;
		}
	}
}